/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"11D958C1-ADED-419F-B7B4-D40327B549A4",variableType:4}
 */
var fDeposito = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"5D257705-0D81-4986-AF15-A6CE41F5F566",variableType:4}
 */
var fEstado = null;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"513F0A51-43EE-4EFB-9BA9-E37B8EB8BC00"}
 */
var fRazonSocial = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"A61B7A08-3545-490E-9663-09201FD508E3",variableType:4}
 */
var fTipo = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"58C89164-E385-429B-A881-F77316976F95",variableType:93}
 */
var fFechaDesde = new Date();

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"58B51EED-3BE1-4701-9517-A801DF69332C",variableType:93}
 */
var fFechaHasta = new Date();

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"CFAB1BD1-ED2B-4B89-B037-AA8C8BC06023"}
 */
function iraDtl(event) {
		forms.recepciones_dtl.controller.loadRecords(recep_cabecera_id)
		globals.mostrarForm('recepciones_dtl')
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"DF7ED235-B9F9-43C7-A765-3666F78E0B11"}
 * @AllowToRunInFind
 */
function onShow(firstShow, event) {
	if (controller.find())
	{
		recep_estado = 2
		controller.search()
	}
	else
		globals.DIALOGS.showErrorDialog('Error','Error al iniciar la búsqueda','OK')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"0C449C15-1023-4F76-939C-E7515699C686"}
 */
function fechasNulas(event) {
	fFechaDesde = null
	fFechaHasta = null
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"69596476-7A1B-4F4A-9FEF-1AB09EF5482C"}
 */
function estadoNulo(event) {
	fEstado = null
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"964DB378-A458-4B12-9DCE-7B3D0EF6430C"}
 */
function tipoNulo(event) {
	fTipo = null
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"AC406B67-663D-4C93-9D1B-FB4EC3BE3941"}
 */
function razonSocialNula(event) {
	fRazonSocial = null
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"BF851A73-DCD1-46FF-A7AA-6832BC9EE0C7"}
 * @AllowToRunInFind
 */
function buscar(event) {
	if (controller.find())
	{
	
		razon_social 	= '%' + fRazonSocial + '%'
		tipo 			= fTipo
		recep_estado 	= fEstado
		if (fFechaDesde != null && fFechaHasta != null)
			fecha 			= '#' + utils.dateFormat(fFechaDesde,'dd-MM-yyyy') + '...' + utils.dateFormat(fFechaHasta,'dd-MM-yyyy') +'|dd-MM-yyyy'
		deposito 		= fDeposito
			
		controller.search()
	}
	else
		globals.DIALOGS.showErrorDialog('Error','Error al iniciar la búsqueda','OK')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"726921A8-9945-4641-B5C7-63D36E92421C"}
 * @AllowToRunInFind
 */
function mostrarTodos(event) {
	controller.loadAllRecords()
}
